package com.lc.cms.kafka;

import com.lc.cms.utils.SystemConstant;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

@Component
@AllArgsConstructor
@Log4j2
public class KafkaProducer {

    private final KafkaTemplate<String, Object> kafkaTemplate;

    public void send(String data) {
        try {
            kafkaTemplate.send(SystemConstant.TOPIC_STATION_PROTOCOL, data);
        } catch (Exception e) {
            log.error(e);
        }
    }
}